<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('海外头程单')" />
	<th:block th:include="include :: list-css" />
	<style type="text/css">
		.layui-tab-title{border-color: #ccc !important;}
		.layui-this{color: rgb(0, 135, 250) !important;background: none !important;}
		.layui-tab-brief > .layui-tab-title .layui-this:after, .layui-tab-brief > .layui-tab-more li.layui-this:after{border-color:  rgb(0, 135, 250) !important;}
		label.layui-form-label {width: 95px;padding-right: 0px;}
		.layui-form-radio {margin-top:0}
		.mid-content{overflow-y:auto}
		.importTable{empty-cells:show;border-collapse:collapse;border-spacing:0;}
		.listext th{background:#eee;color:#3366cc;}
		.listext th,.listext td{border:solid 1px #ddd;text-align:left;padding:10px;font-size:14px;}
		#importProgress {z-index:20200202;background-color: #000;opacity: 0.3;display:none;}
		.importProgress {width:300px;z-index:20202222;position: fixed;top: 34%;left: 40%;display:none;}
	</style>
	
	<!-- 打印控件 -->
	<script src="/js/printWorld/PrintWorld.js"></script>
</head>
<body>
<div class="main-content">
	<div class="content-right">
		<div class="search-top">
			<span>查询条件</span>
			<a href="javascript:;" layadmin-event="flexible" class="menuBtn">
				<i class="layui-icon layui-icon-spread-left" id="LAY_app_flexible" style="color: #fff;"></i>
			</a>
		</div>
		<div class="panel layout-expand layui-expand-east">
			<div class="panel-header">
				<div class="panel-tool" style="text-align: center; width: 26px;height: 30px;line-height: 30px;">
					<a href="javascript:;" layadmin-event="flexible" class="menuBtn">
						<i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible" style="color: #fff;"></i>
					</a>
				</div>
			</div>
			<div class="panel-body panel-title" style="text-align: center; width: 26px;">查<br>询<br>条<br>件</div>
		</div>
		<form class="layui-form">
			<th:block th:include="listinclude :: searchRight('page')" />
		</form>
	</div>
	<div class="mid-content">
		<div class="layui-tab layui-tab-brief istype" lay-filter="demo1" style="margin-top: 0;">
			<ul class="layui-tab-title" >
				<li class="layui-this">头程计划单</li>
				<li>头程货件单</li>
				<li>头程装箱并发货单</li>
				<li>头程完成单</li>
				<li>拆箱单</li>
				<li>拆箱完成单</li>
				<li>取消完成单</li>
			</ul>
			<div class="layui-tab-content"></div>
		</div>
		<table class="layui-hide" id="dhtable" lay-filter="ftable"></table>
		<div class="spxx" style="display: none;">
			<div class="layui-tab layui-tab-brief demo2" lay-filter="demo2" style="position:relative;">
				<ul class="layui-tab-title">
					<li class="detailsName">海外头程计划单</li>
				</ul>
				<div class="layui-tab-content"></div>
			</div>
			<table class="layui-hide" id="pdhtable" lay-filter="pftable"></table>
		</div>

	</div>
</div>
<!-- 表格头部工作栏-->
<script type="text/html" id="toolbar">
	<div class="layui-btn-container">
        <span class="ishide" style="display: none;">
          <div class="layui-btn layui-btn-normal layui-table-tools" lay-event="addbtn" th:if="${extraButton.addbtn}">
            <i class="dhicon dh-lujing1089"></i> 新增
         </div>
		<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="deliver" th:if="${extraButton.deliver}">
            <i class="dhicon dh-lujing1089"></i> 海外仓发货
         </div>
         <div class="layui-btn layui-table-tools importbtn-bg shbtn" lay-event="shbtn" th:if="${extraButton.jhShbtn}">
                <i class="dhicon layui-icon-prev"></i> 审核
            </div>
         <div class="layui-btn layui-btn-danger layui-table-tools delbtn" onclick="remove()" th:if="${extraButton.delbtn}">
                <p class="dhicon dh-remove" style="color:white;font-size:14px"><span class="fa_span">批量删除</span></p>
            </div>
         <div class="layui-btn layui-btn-normal layui-table-tools" lay-event="exportbtn" th:if="${extraButton.jhExportbtn}">
            <i class="dhicon dh-zu4250_2_2"></i> 导出
         </div>
        </span>
		<span class="iszx" style="display: none;">
			<div class="layui-btn layui-table-tools importbtn-bg shbtn" lay-event="shbtn" th:if="${extraButton.hjShbtn}">
                <i class="dhicon layui-icon-prev"></i> 审核
            </div>
			<div class="layui-btn layui-table-tools importbtn-bg htbtn" lay-event="htbtn" th:if="${extraButton.htbtn}">
                <i class="dhicon layui-icon-prev"></i> 回退
            </div>
			 <div class="layui-btn layui-btn-normal layui-table-tools" lay-event="exportbtn" th:if="${extraButton.hjExportbtn}">
            	<i class="dhicon dh-zu4250_2_2"></i> 导出
        	 </div>
	    </span>
		<span class="isfh" style="display: none;">
			<div class="layui-btn layui-btn-normal layui-table-tools" onclick="importBtnNew()" lay-event="inbound " th:if="${extraButton.inbound}">
				<i class="dhicon dh-zu4250_2_2"></i> 装箱清单导入
			</div>
			<div class="layui-btn layui-table-tools importbtn-bg htbtn" lay-event="htbtn" th:if="${extraButton.zxHtbtn}">
                <i class="dhicon layui-icon-prev"></i> 回退
            </div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="deleteBatch" th:if="${extraButton.deleteBatch}">
				<i class="dhicon dh-remove"></i> 配货清单打印
			</div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="printGoods" th:if="${extraButton.printGoods}">
				<i class="dhicon dh-remove"></i> 商品标打印
			</div>
			<div class="layui-btn layui-table-tools importbtn-bg" lay-event="personnelImport" th:if="${extraButton.personnelImport}">
                <i class="dhicon layui-icon-prev"></i> 贴标装箱人导入
            </div>
			<div class="layui-btn layui-table-tools importbtn-bg" lay-event="placeOrder" th:if="${extraButton.placeOrder}">
					<i class="dhicon layui-icon-prev"></i> 上传箱规信息
            </div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="binning" th:if="${extraButton.binning}">
			    <i class="dhicon dh-lujing1089"></i> 分箱
         	</div>
			<div class="layui-btn layui-table-tools importbtn-bg" lay-event="unbox" th:if="${extraButton.unbox}">
                <i class="dhicon layui-icon-prev"></i> 取消装箱
            </div>
			<div class="layui-btn layui-table-tools importbtn-bg" lay-event="fbaImport" th:if="${extraButton.fbaImport}">
                <i class="dhicon layui-icon-prev"></i> FBA导入
            </div>
			<div class="layui-btn layui-table-tools importbtn-bg" lay-event="updateDestinationFulfillmentCenter" th:if="${extraButton.updateDestinationFulfillmentCenter}">
                <i class="dhicon layui-icon-prev"></i> 修改仓库标识
            </div>
			<div class="layui-btn layui-table-tools importbtn-bg shbtn" lay-event="shbtn" th:if="${extraButton.zxShbtn}">
                <i class="dhicon layui-icon-prev"></i> 审核
            </div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="devanning" th:if="${extraButton.devanning}">
				<i class="dhicon dh-zu4250_2_2"></i> 拆箱
			</div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="qxDeliver" th:if="${extraButton.qxDeliver}">
				<i class="dhicon dh-zu4250_2_2"></i> 取消海外仓发货
			</div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="exportbtn" th:if="${extraButton.zxExportbtn}">
            	<i class="dhicon dh-zu4250_2_2"></i> 导出
		 	</div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="transparentPrinting" th:if="${extraButton.transparentPrinting}">
				 <i class="dhicon dh-zu4491"></i> 透明标打印
			 </div>

			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="printPeihuoGoodsTag" th:if="${extraButton.printPeihuoGoodsTag}">
				<i class="dhicon dh-remove"></i> 打印配货商品标签
			</div>
			<div class="layui-btn layui-table-tools importbtn-bg forcedRollback" lay-event="forcedRollback" th:if="${extraButton.forcedRollback}">
                <i class="dhicon layui-icon-prev"></i> 强制回退
            </div>
	    </span>
		<span class="iswc" style="display: none;">
			<div class="layui-btn layui-table-tools importbtn-bg forcedRollback" lay-event="forcedRollback" th:if="${extraButton.forcedRollback}">
                <i class="dhicon layui-icon-prev"></i> 强制回退
            </div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="transparentPrinting" th:if="${extraButton.transparentPrinting}">
				 <i class="dhicon dh-zu4491"></i> 透明标打印
			 </div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="print" th:if="${extraButton.print}">
				<i class="dhicon dh-zu4250_2_2"></i> 打印箱标
			</div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="download" th:if="${extraButton.download}">
				<i class="dhicon dh-zu4250_2_2"></i> C88文件下载
			</div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="exportbtn" th:if="${extraButton.wcExportbtn}">
				<i class="dhicon dh-zu4250_2_2"></i> 导出
			</div>
			<div class="layui-btn layui-table-tools importbtn-bg zxwcShbtn" lay-event="zxwcShbtn" th:if="${extraButton.zxwcShbtn}">
                <i class="dhicon layui-icon-prev"></i> 审核
            </div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="devanningWc" th:if="${extraButton.devanningWc}">
				<i class="dhicon dh-zu4250_2_2"></i> 完成单拆箱
			</div>
		 </span>

		<span class="isshow" style="display: none;">
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="exportbtn" th:if="${extraButton.cxwcExportbtn}">
				<i class="dhicon dh-zu4250_2_2"></i> 导出
			</div>
	    </span>
		<span class="iscx" style="display: none;">
			<div class="layui-btn layui-table-tools importbtn-bg shbtn" lay-event="shbtn" th:if="${extraButton.cxShbtn}">
                <i class="dhicon layui-icon-prev"></i> 审核
            </div>
			<div class="layui-btn layui-btn-normal layui-table-tools" lay-event="exportbtn" th:if="${extraButton.cxExportbtn}">
				<i class="dhicon dh-zu4250_2_2"></i> 导出
			</div>
	    </span>
	</div>
</script>

<script type="text/template" id="importTpl">
	<form enctype="multipart/form-data" class="mt20 mb10">
		<div class="col-xs-offset-1">
			<input type="file" id="file" name="file"/>
			<div class="mt10 pt5">
				<a onclick="$.tablelist.importTemplate('/logstics/fbabox/export?num')" class="btn btn-default btn-xs"><i class="dhicon dh-file-excel-o"></i> 下载模板</a>
			</div>
			<font color="red" class="pull-left mt10">提示：仅允许导入“xls”或“xlsx”格式文件！</font>
		</div>
	</form>
</script>
<!-- 导入明细 -->
<div id="iTable" class="display_no">
	<table class="importTable listext" data-resizable-columns-id="demo-table">
		<tbody id="itbody"></tbody>
	</table>
</div>


<th:block th:include="include :: footer" />
<th:block th:include="include :: businessJS" />
<th:block th:include="include :: searchJS" />
<script th:src="@{/dhecp/js/queryCondition.js}"></script>
<th:block th:include="listinclude :: list-templeat" />
<script th:inline="javascript">
	var gridColumns = [[${gridColumns}]],
			business = [[${business}]],
			buttonState = [[${buttonState}]],
			businessName = gridColumns.moduleAlias,
			passwordAuthentication = [[${passwordAuthentication}]],
			moduleTable = [[${moduleTable}]],
			ali1688EcpApiUrl = [[${ali1688EcpApiUrl}]],
			importFields =[[${importFields}]];
			importFieldFH = '';
			userId = "";
	var prefix = "/business/"+business;
	var prefixHj = "/logstics/fbaShipment";
	var prefixZx = "/logstics/fbabox";
	var prefixQx = "/logstics/fbaCancel";
	var prefixDev = "/logstics/fbaDevanning";
	var tableUrl = prefix + "/list",
	openRowUrl = "/business/"+(business.split('/')[1]?business.split('/')[0]:business)+"/edit?nid=";
	exportUrl = prefix + "/export";
</script>
<script type="text/javascript">
	var element,thStr;
	var fieldWidth = {},		//导入列表字段宽度
			filedRequired = {},		//导入列表必填字段
			dateFiled = [],			//导入列表日期字段
			hasNull = false;		//导入数据必填字段有空值
	$.each(gridColumns.dictionaryForPageFieldList,function(i,v){
		fieldWidth[v.fields] = v.fieldFrontWidth
		if(v.fieldFrontRequired)filedRequired[v.fields] = v.fieldName;
		if(v.fieldFrontType == 't_date')dateFiled.push(v.fields);
	})
	//发货标题
	var tablecolsFh=tablecolsFh();

	var $,layer,laydate,form,table,wherestr={};
	layui.use(['table','laydate','form','layer','jquery','element'], function () {
		$ = layui.$, layer = layui.layer,laydate = layui.laydate , form = layui.form, table = layui.table, element = layui.element;
		serachRender();//查询条件初始渲染集合
		changeDropdown('fSl');//导入窗口——税率下拉可编辑赋事件
		var num = 0;
		var urlSh = "";
		$.tablelist.init({
			elem: '#dhtable'
			,modalName: "产品信息"
			,url: tableUrl
			,updateUrl: prefix + "/edit?guid={id}"
			,initSort: {field: 'createTime',type: 'asc'}
			,totalRow: gridColumns.totalRow
			,cols: [gridColumns.gridBody]
			,toolbar: '#toolbar'
			,defaultToolbar: [{title:'列设置',layEvent: 'fieldSet',icon: 'layui-icon-set'}] //这里在右边显示
			,parseData: function(res){ //res 即为原始返回的数据
				var objpage=sessionStorage.getItem(moduleTable+'checkdata')
				if(objpage){
					objpage=JSON.parse(objpage)
					res.data.map((v,i)=>{
						objpage.map((n,m)=>{
							if(v.guid==n.guid){
						v.LAY_CHECKED=true
					}
				})
				})
				}
			}
			,done:function(res, curr, count){
				var ltv=this.elem.next('.layui-table-view');//当前table的dom
				res.data.length || count || ltv.find('.layui-table-header').css('display', 'inline-block');//数量为0时(统计报表存在不传count的情况)，表头赋予样式可拉动
				res.data.length || count || ltv.find('.layui-table-box').css('overflow-x', 'auto');//数量为0时(统计报表存在不传count的情况)，表头赋予样式可拉动
				if($('.spxx').is(':hidden')){
					$('.layui-table-body').eq(0).css('height', "75vh");
				}else{
					$('.layui-table-body').eq(0).css('height', "40vh");
				}
				$('.ishide').show()
				$('.isshow').hide()
				$('.iszx').hide()
				$('.isfh').hide()
				$('.iscx').hide()
				$('.iswc').hide()
				fixTotal(this);//修复合计行固定列问题
				rowheight(res, curr);//修复合计行固定列问题
				if(typeof listTableDone == 'function')listTableDone();//如果查询列表存在表格加载完成回调事件，则执行
			}
		});
		//监听排序事件
		table.on('sort(ftable)', function(obj){
			$.tablelist.sort('dhtable',obj);
		});

		//监听行双击事件
		table.on('rowDouble(ftable)', function (obj) {
			if (num == 0){
				if (obj.data.isDeliver == 0){
					if (typeof buttonState == 'object' && buttonState['list-add'] !== 'hidden') parent.layui.index.openTabsPage(prefix+ "/edit?nid="+obj.data.nid+ '&isDeliver='+obj.data.isDeliver, "头程计划单" + '(' + obj.data.bid + ')');
				}  else {
					if (typeof buttonState == 'object' && buttonState['list-add'] !== 'hidden') parent.layui.index.openTabsPage(prefix+ "/edit?nid="+obj.data.nid+ '&isDeliver='+obj.data.isDeliver, "头程计划单-海外仓发货" + '(' + obj.data.bid + ')');
				}
			} else if(num == 1){
				if (typeof buttonState == 'object' && buttonState['list-add'] !== 'hidden') parent.layui.index.openTabsPage(prefixHj+ "/edit?guid="+obj.data.guid, "头程货件单" + '(' + obj.data.code + ')');
			} else if(num == 2){
				if (typeof buttonState == 'object' && buttonState['list-add'] !== 'hidden') parent.layui.index.openTabsPage(prefixZx+ "/edit?guid="+obj.data.guid, "头程装箱并发货单" + '(' + obj.data.code + ')');
			}else if(num == 3){
				if (typeof buttonState == 'object' && buttonState['list-add'] !== 'hidden') parent.layui.index.openTabsPage(prefixZx+ "/edit?guid="+obj.data.guid, "头程完成单" + '(' + obj.data.code + ')');
			}else if(num == 4){
				if (typeof buttonState == 'object' && buttonState['list-add'] !== 'hidden') parent.layui.index.openTabsPage(prefixDev+ "/edit?guid="+obj.data.guid, "拆箱单" + '(' + obj.data.codeDevanning + ')');
			}else if(num == 5){
				if (typeof buttonState == 'object' && buttonState['list-add'] !== 'hidden') parent.layui.index.openTabsPage(prefixDev+ "/edit?guid="+obj.data.guid, "拆箱单" + '(' + obj.data.codeDevanning + ')');
			}else if(num == 6){
				if (typeof buttonState == 'object' && buttonState['list-add'] !== 'hidden') parent.layui.index.openTabsPage(prefixQx+ "/edit?guid="+obj.data.guid, "取消单" + '(' + obj.data.codeCancel + ')');
			}
		});
		// 多选赋值
		sessionStorage.setItem(moduleTable+'checkdata','')
		table.on('checkbox(ftable)', function(obj){
			var objpage=sessionStorage.getItem(moduleTable+'checkdata')
			if(obj.type=='all'){//判断是否全选
				var objdata=table.checkStatus('dhtable')
				objdata=objdata.data
				if(obj.checked){//判断是否选中
					if(objpage){
						objpage=JSON.parse(objpage)
						objpage=objpage.concat(objdata)
						objpage=newData(objpage)
					}else{
						objpage=objdata
					}
				}else{
					var objpage=JSON.parse(objpage)
					var deldata=table.cache.dhtable
					objpage=delData(objpage,deldata)
				}
				sessionStorage.setItem(moduleTable+'checkdata',JSON.stringify(objpage))
			}else{//点击复选框
				if(objpage){
					objpage=JSON.parse(objpage)
					if(obj.checked){
						objpage.push(obj.data)
					}else{
						objpage.map((v,i)=>{
							if(v.guid==obj.data.guid){
							objpage.splice(i,1)
						}
					})
					}
				}else{
					objpage=[]
					objpage.push(obj.data)
				}
				sessionStorage.setItem(moduleTable+'checkdata',JSON.stringify(objpage))
			}
		});

		// 头部组装切换
		element.on('tab(demo1)', function(elem){
			sonList(elem.index);
		});

		function sonList(index){
			num = index;
			var tableUrl1 = ""
			switch(index){
				case 0://头程计划单
					tableUrl1 = prefix+"/list"
					moduleTable = "TP_FBAPLANORDER";
					break;
				case 1://头程货件单
					tableUrl1 = prefixHj+"/list"
					moduleTable = "TP_FbaShipment";
					break;
				case 2://头程装箱发货单
					tableUrl1 = "/logstics/fbabox/list?num=0";
					moduleTable = "TP_FBABOX";
					break;
				case 3://头程完成单
					tableUrl1 = "/logstics/fbabox/list?num=1";
					moduleTable = "TP_FBABOXS";
					break;
				case 4://头程拆箱单
					tableUrl1 = "/logstics/fbaDevanning/list?num=0"
					moduleTable = "TP_FbaDevanning";
					break;
				case 5://头程拆箱完成单
					tableUrl1 = "/logstics/fbaDevanning/list?num=1"
					moduleTable = "TP_FbaDevanning";
					break;
				case 6://头程取消单
					tableUrl1 = "/logstics/fbaCancel/list?num=1"
					moduleTable = "TP_FbaCancel";
					break;
			};
			sessionStorage.clear();
			$.get(prefix+"/switchover",{num:num},function(data){
				//给装箱人审核人使用
				userId = data.userId
				// 初始化表格
				$.tablelist.init({
					elem: '#dhtable'
					,url: tableUrl1
					, totalRow: data.totalRow
					, cols: [data.gridBody]
					, toolbar: '#toolbar'
					, defaultToolbar: [{title: '列设置', layEvent: 'fieldSet', icon: 'layui-icon-set'}]
					, height: '450'
					, done: function (res, curr, count) {
						listData1 = table.cache.dhtable;//每次重载都赋值更新表缓存
						$('.spxx').hide()
						$('.layui-table-body').eq(0).css('height', "75vh");
						if(num == 0){
							$('.ishide').show()
							$('.isshow').hide()
							$('.iszx').hide()
							$('.iscx').hide()
							$('.iswc').hide()
							$('.detailsName').text("海外头程计划单");
						}else if(num == 1){
							$('.ishide').hide()
							$('.isshow').hide()
							$('.iszx').show()
							$('.iscx').hide()
							$('.iswc').hide()
							$('.detailsName').text("海外头程货件单");
						}else if(num == 2){
							$('.ishide').hide()
							$('.isshow').hide()
							$('.iszx').hide()
							$('.isfh').show()
							$('.iscx').hide()
							$('.iswc').hide()
							$('.detailsName').text("海外头程装箱清单");
						}else if(num == 3){
							$('.ishide').hide()
							$('.isshow').hide()
							$('.iszx').hide()
							$('.isfh').hide()
							$('.iscx').hide()
							$('.iswc').show()
							$('.detailsName').text("海外头程装箱清单");
						}else if(num == 4){
							$('.ishide').hide()
							$('.iscx').show()
							$('.isshow').hide()
							$('.iszx').hide()
							$('.isfh').hide()
							$('.iswc').hide()
							$('.detailsName').text("海外头程装箱清单");
						}else if(num == 5){
							$('.ishide').hide()
							$('.iscx').hide()
							$('.isshow').show()
							$('.iszx').hide()
							$('.isfh').hide()
							$('.iswc').hide()
						}else if(num == 6){
							$('.ishide').hide()
							$('.iscx').hide()
							$('.isshow').show()
							$('.iszx').hide()
							$('.isfh').hide()
							$('.iswc').hide()
						}
						// fixTotal(this);//修复合计行固定列问题
						// rowheight(res, curr);//修复合计行固定列问题
					},success:function(a,b,c){
						console.log(a,b,c)
					}
				});
				importFields = data.importFields;//赋值导入模板字段
				importFieldFH = data.importFieldFH;//赋值导入标记发货模板字段
				var cephalosome = document.getElementById("cephalosome");//获取所有的table
				var str = queryCondition(data.fixtype);
				cephalosome.innerHTML = str;
				form.render();
				$('#btn-search').unbind()
				serachRender()
				setTimeout(() => {firstimg()}, 1000);
			});
		}


		//刷新详情列表表格
		function pddata1(obj,num){
			var code = "";
			var codeShipment = "";
			if (num == 0 || num == 1 ){
				code = obj.data.code;
			} else if (num == 2 || num == 3){
				code = obj.data.code;
				codeShipment = obj.data.codeShipment;
			}else if (num == 4 || num == 5){
				// return
				code = obj.data.codeBox;
				codeShipment = obj.data.codeDispatch;
			}else if (num == 6){
				code = obj.data.codeBox;
				codeShipment = obj.data.codeShipment;
			}
			$('.demo2 .layui-tab-title li').removeClass('layui-this')
			$('.layui-tab-title li').attr('style','background:#fff;color:#666666');
			$('.demo2 .layui-tab-title li').eq(0).addClass('layui-this')
			$.get(prefix+'/sonlist',{code:code,num:num,codeShipment:codeShipment,creationMethod:obj.data.creationMethod},function(res){
				var datalist=res.data.sonList;
				var cols=[res.data.gridColumns.gridBody];
				var totalRow=res.data.gridColumns.totalRow;
			    if (num == 2 ||num == 3 ||num == 4 ||num == 5 || num == 6){
			    	if (obj.data.creationMethod == '手动'){
						cols = tablecolsFh;
					} else {
						cols = tablecolsZD();
						//根据coleSize编辑出多少个箱子
						for (let i = 0; i < obj.data.numBox; i++) {
							let  tableData = {
								"align": "center",
								"field": "numRealityDeliver"+(i+1),
								"title": "箱子"+(i+1),
								"width": 95,
							}
							cols[0].push(tableData);
						}

						//将箱子数据赋值
						if (obj.data.numBox != 0){
							for (let i = 0; i < datalist.length; i++) {
								let ss = datalist[i].boxList.slice(1,datalist[i].boxList.length-1)
								let aa =  ss.split(",");
								for (let j = 0; j < aa.length; j++) {
									let numRe = 'numRealityDeliver'+(j+1)
									datalist[i][numRe] = aa[j]==0?"":aa[j]
								}
							}
						}
					}
				}
				$.tablelist.init({
					elem: '#pdhtable'
					,data:datalist
					,limit: 99999
					,where: getWherestr()
					,totalRow:totalRow
					,cols: cols
					,defaultToolbar: [{title:'列设置',layEvent: 'fieldSet',icon: 'layui-icon-set'}]
					,page:false
					// ,height:moduleTable==''?'full-46':''
					,parseData: function(res){ //res 即为原始返回的数据
						return {
							"code": res.code, //解析接口状态
							"msg": res.msg, //解析提示文本
							"count": res.count, //解析数据长度
							"data": decimalToFixed(res.data,gridColumns.decimalObj) //表格数据数值类型重赋值
						}
					}
					,done:function(res, curr, count){
						var ltv=this.elem.next('.layui-table-view');//当前table的dom
						res.data.length || count || ltv.find('.layui-table-header').css('display', 'inline-block');//数量为0时(统计报表存在不传count的情况)，表头赋予样式可拉动
						res.data.length || count || ltv.find('.layui-table-box').css('overflow-x', 'auto');//数量为0时(统计报表存在不传count的情况)，表头赋予样式可拉动
						res.data.length || count || ltv.find('.layui-table-body').css('height', ltv.find('.layui-table-body').height()-17);//数量为0时，表格高度减少滚动条高度
						$('.spxx').show()
						$('.layui-table-body.layui-table-main').eq(0).css('height', "35vh");
						$('.layui-table-body.layui-table-main').eq(1).css('height', "30vh");
						$('.layui-table-body').eq(1).css('height', "calc(35vh - 15px)");
						fixTotal(this);//修复合计行固定列问题
						if(typeof listTableDone == 'function')listTableDone();//如果查询列表存在表格加载完成回调事件，则执行
					}
					,jump:function(obj, first){
					}
				})
			})
		}

		//单击选中行
		var comguid,comobj
		table.on('row(ftable)', function(obj){
			comguid=obj.data.guid
			comobj=obj
			pddata1(obj,num)
		});

		//头工具栏事件
		table.on('toolbar(ftable)', function(obj){
			var shbtnUrl;
			if (num == 0){
				shbtnUrl = prefix;
			} else if(num == 1){
				shbtnUrl = prefixHj;
			}else if(num == 2 || num == 3){
				shbtnUrl = prefixZx;
			}else if(num == 4 || num == 5){
				shbtnUrl = prefixDev;
			}else if(num == 6){
				shbtnUrl = prefixQx;
			}
			switch(obj.event){
				case 'addbtn'://新增
					parent.layui.index.openTabsPage(prefix+'/edit?isDeliver=0', '头程计划单 - 新增');
					break;
					case 'deliver'://海外仓发货
					parent.layui.index.openTabsPage(prefix+'/edit?isDeliver=1', '头程计划单 - 海外仓发货');
					break;
				case 'binning'://分箱
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请选择一条数据！");
						break;
					}
					var infoItems=JSON.parse(objpage);
					if(infoItems.length == 0) {
						layer.msg("至少选择一条数据！");
						break;
					}
					if(infoItems.length > 1) {
						layer.msg("只能选择一条数据！");
						break;
					}
					if (infoItems.some(item => item.state != '2')) {
						layer.msg("选择数据只允许是装箱状态下,请核实后在操作！");
						return;
					}
					let voluntarily = infoItems.some(item => item.creationMethod == '自动');
					if (voluntarily){
						layer.msg("选择单据货件创建方式是自动,不允许分箱,请核实后在操作!");
						return;
					}
					if (infoItems.some(item => item.isBinning == '是')) {
						layer.msg("该头程装箱单已分箱,不允许分箱,请核实后在操作！");
						return;
					}
					if (typeof buttonState == 'object' && buttonState['list-add'] !== 'hidden') parent.layui.index.openTabsPage(prefixZx+ "/binningEdit?guid="+infoItems[0].guid, "分箱" + '(' + infoItems[0].code + ')');
					break;
				case 'updatebox'://修改箱子数据
					$.operate.post('/logstics/fbabox/updatebox',{Codes: "123"},function(result){
						if (result.code == 0){
							window.open(result.data)
							setTimeout(function(){
								sessionStorage.setItem(moduleTable+'checkdata','')
								table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
							}, 1000);
						}
					});
					break;
				case 'deleteBatch'://配货清单打印
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("至少选择一条数据！");
						break;
					}
					var infoItems=JSON.parse(objpage);
					if(infoItems.length == 0) {
						layer.msg("至少选择一条数据！");
						break;
					}
					var codes = '';
					for(var i=0; i<infoItems.length; i++) {
						codes = codes + infoItems[i].code + ',';
					}
					$.operate.post('/logstics/fbabox/generatePeihuoPDF',{Codes: codes},function(result){
						if (result.code == 0){
							window.open(result.data)
							setTimeout(function(){
								sessionStorage.setItem(moduleTable+'checkdata','')
								table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
							}, 1000);
						}
					});
					break;
				case 'printGoods'://商品标打印
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请选择一条数据！");
						break;
					}
					var infoItems=JSON.parse(objpage);
					if(infoItems.length > 1) {
						layer.msg("只能选择一条数据！");
						break;
					}
					if (infoItems.some(item => item.statePrint == '0')) {
						layer.msg("选择单据中配货清单未打印,请核实后在操作!");
						break;
					}
					
					var w=($(window).width()*0.8);
					var h=($(window).height() - 100);
					var index = layer.open({
						type: 2,
						area: [w+'px', h +'px'],
						fix: true,
						maxmin: false,
						shadeClose: true,
						shade:0.4,
						title: "打印商品标",
						content: '/logstics/fbabox/toPrintGoods?code=' + infoItems[0].code
					});
					break;
				case 'transparentPrinting'://透明标打印
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请选择一条数据！");
						break;
					}
					var infoItems=JSON.parse(objpage);
					if(infoItems.length > 1) {
						layer.msg("只能选择一条数据！");
						break;
					}

					var w=($(window).width()*0.8);
					var h=($(window).height() - 100);
					var index = layer.open({
						type: 2,
						area: [w+'px', h +'px'],
						fix: true,
						maxmin: false,
						shadeClose: true,
						shade:0.4,
						title: "打印透明标",
						content: '/logstics/fbabox/transparentPrinting?code=' + infoItems[0].code
					});
					break;
				case 'shbtn'://审核
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else{
						$.modal.confirmCom('确定要审核么？',function(result) {
							var infoItems = JSON.parse(objpage);
							if (num == 0) {
								if (infoItems.some(item => item.effectStock == false)) {
									layer.msg("选择单据有制单状态,请核实后在操作!");
									return;
								}
								if (infoItems.some(item => item.state == '1')) {
									layer.msg("选择单据有已审核状态,请核实后在操作!");
									return;
								}
								let voluntarily = infoItems.some(item => item.creationMethod == '自动');
								let handMovement = infoItems.some(item => item.creationMethod == '手动');
								if (voluntarily && handMovement) {
									layer.msg("选择单据货件创建方式只允许单一选择,请核实后在操作!");
									return;
								}
								if (handMovement) {
									urlSh = ali1688EcpApiUrl + '/api/fbaInbound/addParcel';
									post(urlSh,infoItems,userId);
								} else {
									if (infoItems.length > 1) {
										layer.msg("选择单据货件创建方式只允许选择一条数据,请核实后在操作!！");
										return;
									}
                                    urlSh = ali1688EcpApiUrl+'/api/fbaInbound/addParcelZD';
									//填写备注
									layer.open({
										type: 1,
										area: ['400px', '200px'],
										title: '输入密码',
										offset: '20%',
										shadeClose: true,
										content: `
											<div class="layui-form-item">
												<label class="layui-form-label"><i style="color:red">*&nbsp;&nbsp;</i>密码</label>
												<div class="layui-input-block">
													<input type="password" name="oldPwd"  required  lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input oldPwd"
												maxlength="20">
												</div>
											</div>
												`,
										btn: ['确认', '取消'],
										yes: function (index, layero) {
											var oldPwd = $('.oldPwd').val().trim()
											if (oldPwd.replace(/(^\s*)|(\s*$)/g, "") == "") {
												return layer.msg("请输入密码!")
											}
											if (infoItems[0].regionName == '欧洲'){
												if (oldPwd == 'MINIEASE'){
													post(urlSh,infoItems,userId);
												} else {
													return layer.msg("密码错误!")
												}
											} else {
												if (oldPwd == '+/MinieasE/-'){
													post(urlSh,infoItems,userId);
												}else {
													return layer.msg("密码错误!")
												}
											}
										}
									});
                                }
							} else if (num == 2){
								urlSh = ali1688EcpApiUrl+'/api/fbaInbound/deleteOrModify';
								if (infoItems.some(item => item.state != '3')) {
									layer.msg("选择单据只允许是已导入FBA状态,请核实后在操作!");
									return;
								}
								if (infoItems.some(item => item.state == '1')) {
									layer.msg("选择单据有已审核状态,请核实后在操作!");
									return;
								}
							} else {
								urlSh = shbtnUrl + '/updateState';
							}
							if (num == 2) {
								if (infoItems.some(item => Number(item.warehouseSurcharge) > 0)) {
									$.modal.confirmCom('该仓库存在仓库附加费，请确认？', function (result) {
										if (result == true) {
											if (infoItems.some(item => item.stateShareTicketName == '否' && Number(item.weightCalA1) < Number(item.singlePassCrane))) {
												$.modal.confirmCom('头程未满足该渠道的单票发货起重，是否按照该渠道的发货起重去结算发货？', function (result) {
													if (result == true) {
														post(urlSh, infoItems, userId);
													}
												});
											} else {
												post(urlSh, infoItems, userId);
											}
										}
									});
								} else {
									if (infoItems.some(item => item.stateShareTicketName == '否' && Number(item.weightCalA1) < Number(item.singlePassCrane))) {
										$.modal.confirmCom('头程未满足该渠道的单票发货起重，是否按照该渠道的发货起重去结算发货？', function (result) {
											if (result == true) {
												post(urlSh, infoItems, userId);
											}
										});
									} else {
										post(urlSh, infoItems, userId);
									}
								}
							} else if (num == 0){
									return;
							}else {
								post(urlSh,infoItems,userId);
							}
						});
					}
					break;
				case "exportbtn"://导出
					$.ajax({
						url: shbtnUrl+'/export?num='+num,
						type: 'GET',
						data: getWherestr(),
						dataType: 'json',
						beforeSend: function () {
							showloadings(true);
						},
						success: function (result) {
							if (result.code == 0) {
								window.location.href = ctx + "common/download?fileName=" + encodeURIComponent(result.msg) + "&delete=" + true;
								parent.$('.page-loading').hide();//页面进行了跳转刷新，需要手动关闭页面的加载动画
							} else if (result.code == web_status.WARNING) {
								$.modal.alertWarning(result.msg)
							} else {
								$.modal.alertError(result.msg);
							}
							showloadings(false);
						}
					});
					break;
				case 'htbtn'://回退
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else {
						$.modal.confirmCom('确定要回退么？', function (result) {
							var infoItems = JSON.parse(objpage)
							if (num == 1){
								if (infoItems.some(item => item.state == '1')) {
									layer.msg("选择单据有已审核状态,请核实后在操作!");
									return;
								}
								urlSh = ali1688EcpApiUrl+'/api/fbaInbound/cancelParcel';
							} else if (num == 2){
								if (infoItems.some(item => item.statePrint != '0' && item.statePrint != '1')) {
									layer.msg("选择单据已打印商品标,不允许回退!");
									return;
								}
								let voluntarily = infoItems.some(item => item.creationMethod == '自动');
								let handMovement = infoItems.some(item => item.creationMethod == '手动');
								if (voluntarily && handMovement){
									layer.msg("选择单据货件创建方式只允许单一选择,请核实后在操作!");
									return;
								}
								if (handMovement){
									urlSh = ali1688EcpApiUrl+'/api/fbaInbound/rollbackState';
								} else {
									urlSh = ali1688EcpApiUrl+'/api/fbaInbound/rollbackState';
								}

							} else {
								urlSh = shbtnUrl+'/rollbackState';
							}
							showloadings(true);
							$.operate.post(urlSh, {
								infoItems: JSON.stringify(infoItems)
							}, function (result) {
								if (result.code == 0) {
									setTimeout(function () {
										sessionStorage.setItem(moduleTable + 'checkdata', '')
										showloadings(false);
										table.reload('dhtable', {page: {curr: 1}, where: getWherestr()});
									}, 1000);
								} else {
									showloadings(false);
								}
							});
						});
					}
					break;
				case 'forcedRollback'://强制回退
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else {
						$.modal.confirmCom('确定要强制回退么？', function (result) {
							var infoItems = JSON.parse(objpage)
							let handMovement = infoItems.some(item => item.creationMethod == '手动');
							if (handMovement){
								layer.msg("选择单据货件创建方式只允许是自动下,请核实后在操作!");
								return;
							}
							urlSh = ali1688EcpApiUrl+'/api/fbaInbound/forcedRollback';
							showloadings(true);
							$.operate.post(urlSh, {
								infoItems: JSON.stringify(infoItems)
							}, function (result) {
								if (result.code == 0) {
									setTimeout(function () {
										sessionStorage.setItem(moduleTable + 'checkdata', '')
										showloadings(false);
										table.reload('dhtable', {page: {curr: 1}, where: getWherestr()});
									}, 1000);
								} else {
									showloadings(false);
								}
							});
						});
					}
					break;
				case 'wchtbtn'://头程完成回退
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else {
						$.modal.confirmCom('确定要回退么？', function (result) {
							var infoItems = JSON.parse(objpage)
							if (infoItems.some(item => item.stateTrack == '1')) {
								layer.msg("选择单据已审核通过,不允许回退!");
								return;
							}
							if (infoItems.some(item => item.stateTrack == '5')) {
								layer.msg("选择单据C88文件已导入,不允许回退!");
								return;
							}
							if (infoItems.some(item => item.stateTrack == '2')) {
								layer.msg("选择单据发票清单已打出,不允许回退!");
								return;
							}
							if (infoItems.some(item => item.stateTrack == '3')) {
								layer.msg("选择单据物流已发货,不允许回退!");
								return;
							}
							if (infoItems.some(item => item.stateTrack == '4')) {
								layer.msg("选择单据已导入追踪编号,不允许回退!");
								return;
							}
							showloadings(true);
							$.operate.post(ali1688EcpApiUrl+'/api/fbaInbound/completeBackoff', {
								infoItems: JSON.stringify(infoItems)
							}, function (result) {
								if (result.code == 0) {
									setTimeout(function () {
										sessionStorage.setItem(moduleTable + 'checkdata', '')
										showloadings(false);
										table.reload('dhtable', {page: {curr: 1}, where: getWherestr()});
									}, 1000);
								} else {
									showloadings(false);
								}
							});
						});
					}
					break;
				case 'fieldSet':
					filedSet(moduleTable);
					break;
				case 'devanning':
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					var infoItems = JSON.parse(objpage)
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else if (infoItems.some(item => item.state != '2') && infoItems.some(item => item.state != '3')) {
						layer.msg("已装箱状态和FBA导入状态外不允许拆箱,请核实后在操作!");
						return;
					}else if (infoItems.some(item => item.isDeliver == 1)) {
						layer.msg("选择单据不允许海外仓头程拆箱,请核实后在操作!");
						return;
					}else {
						layer.confirm('确定要拆箱么?', {
							icon: 3,
							offset: '10%',
							title: "系统提示",
							shadeClose:true,
							btn: ['确认', '取消'],
							yes: function(index){
								//确认关闭当前diglog
								layer.closeAll('dialog');
								//填写备注
								layer.open({
									type: 1,
									area: ['400px', '200px'],
									title: '拆箱备注',
									offset: '20%',
									shadeClose:true,
									content: `<div><textarea name="desc" maxlength="200" placeholder="请输入备注内容" class="layui-textarea remark"></textarea></div>`,
									btn: ['确认', '取消'],
									yes: function (index, layero) {
										var remark = $('.remark').val()
										var infoItems=JSON.parse(objpage)
										showloadings(true);
										$.operate.post(ali1688EcpApiUrl+'/api/fbaInbound/deleteOrModify',{infoItems:JSON.stringify(infoItems),"remark":remark,'num':1,'state':4,"moduleTable":"TP_FbaDevanning",userId:userId},function(result){
											if (result.code == 0) {
												setTimeout(function(){
													layer.closeAll();
													sessionStorage.setItem(moduleTable+'checkdata','')
													showloadings(false);
													table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
												}, 1000);
											} else {
												showloadings(false);
											}
										});
									}
								});
							},
							btn2: function(){
								//layer.closeAll();
								return true;
							}
						});
					}
					break;
				case 'devanningWc':
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					var infoItems = JSON.parse(objpage)
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else if (infoItems.some(item => item.stateTrackName != '无')) {
						layer.msg("该物流状态不允许拆箱,请核实后在操作!");
						return;
					}else {
						layer.confirm('确定要拆箱么?', {
							icon: 3,
							offset: '10%',
							title: "系统提示",
							shadeClose:true,
							btn: ['确认', '取消'],
							yes: function(index){
								//确认关闭当前diglog
								layer.closeAll('dialog');
								//填写备注
								layer.open({
									type: 2,
									area: ['704px', '297px'],
									title: '拆箱信息',
									offset: '20%',
									shadeClose:false,
									content: '/logstics/fbabox/devanningWc?code=' + infoItems[0].code,
								});
							},
							btn2: function(){
								return true;
							}
						});
					}
					break;
				case 'qxDeliver':
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					var infoItems = JSON.parse(objpage)
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else if (infoItems.some(item => item.state != '2') && infoItems.some(item => item.state != '3')) {
						layer.msg("已装箱状态和FBA导入状态外不允许拆箱,请核实后在操作!");
						return;
					}else if (infoItems.some(item => item.isDeliver == 0)) {
						layer.msg("选择单据只允许海外仓头程取消,请核实后在操作!");
						return;
					}else {
						layer.confirm('确定要取消么?', {
							icon: 3,
							offset: '10%',
							title: "系统提示",
							shadeClose:true,
							btn: ['确认', '取消'],
							yes: function(index){
								//确认关闭当前diglog
								layer.closeAll('dialog');
								//填写备注
								layer.open({
									type: 1,
									area: ['400px', '200px'],
									title: '取消备注',
									offset: '20%',
									shadeClose:true,
									content: `<div><textarea name="desc" maxlength="200" placeholder="请输入备注内容" class="layui-textarea remark"></textarea></div>`,
									btn: ['确认', '取消'],
									yes: function (index, layero) {
										var remark = $('.remark').val()
										var infoItems=JSON.parse(objpage)
										showloadings(true);
										$.operate.post(ali1688EcpApiUrl+'/api/fbaInbound/deleteOrModify',{infoItems:JSON.stringify(infoItems),"remark":remark,'num':2,'state':4,"moduleTable":"TP_FbaCancel",userId:userId},function(result){
											if (result.code == 0) {
												setTimeout(function(){
													layer.closeAll();
													sessionStorage.setItem(moduleTable+'checkdata','')
													showloadings(false);
													table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
												}, 1000);
											} else {
												showloadings(false);
											}
										});
									}
								});
							},
							btn2: function(){
								//layer.closeAll();
								return true;
							}
						});
					}
					break;
				case 'fbaImport':
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					var infoItems = JSON.parse(objpage)
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
						return;
					}else if(infoItems.length > 1){
						layer.msg("只允许选择一条数据,请核实后在操作！");
						return;
					}else if(infoItems.some(item => item.state != '2')){
						layer.msg("选择数据只允许是装箱状态下,请核实后在操作！");
						return;
					}else {
						layer.confirm('确定要导入FBA么?', {
							icon: 3,
							offset: '10%',
							title: "系统提示",
							btn: ['确认', '取消'],
							shadeClose:true,
							yes: function(index){
								//确认关闭当前diglog
								layer.closeAll('dialog');
								//填写备注
								layer.open({
									type: 1,
									area: ['354px', '178px'],
									title: 'FBA导入',
									offset: '20%',
									shadeClose:true,
									content: `
										<div class="layui-form-item">
											<label class="layui-form-label"><i style="color:red">*&nbsp;&nbsp;</i>FBA编号</label>
											<div class="layui-input-block">
												<input type="text" name="remark"  required  lay-verify="required" placeholder="请输入FBA编号" autocomplete="off" class="layui-input remark"
												maxlength="20" value=${infoItems[0]?.shipmentId?infoItems[0]?.shipmentId: ''}>
											</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label"><i style="color:red">*&nbsp;&nbsp;</i>货件追踪编码</label>
											<div class="layui-input-block">
												<input type="text" name="trackingCode" required  lay-verify="required" placeholder="请输入货件追踪编码" autocomplete="off" class="layui-input trackingCode"
												maxlength="20">
											</div>
										</div>
									`,
									btn: ['确认', '取消'],
									yes: function (index, layero) {
										var remark = $('.remark').val().trim()
										var trackingCode = $('.trackingCode').val().trim()
										if (remark.replace(/(^\s*)|(\s*$)/g, "") == "") {
											return layer.msg("请填写FBA编号!")
										}
										if (trackingCode.replace(/(^\s*)|(\s*$)/g, "") == "") {
											return layer.msg("请填写货件追踪编号!")
										}
										var infoItems=JSON.parse(objpage)
										showloadings(true);
										$.operate.post(ali1688EcpApiUrl+'/api/fbaInbound/fbaImport',{infoItems:JSON.stringify(infoItems),"remark":remark,"trackingCode":trackingCode},function(result){
											if (result.code == 0) {
												setTimeout(function () {
													layer.closeAll();
													sessionStorage.setItem(moduleTable + 'checkdata', '')
													showloadings(false);
													table.reload('dhtable', {page: {curr: 1}, where: getWherestr()});
												}, 1000);
											} else {
												showloadings(false);
											}
										});
									}
								});
							},
							btn2: function(){
								//layer.closeAll();
								return true;
							}
						});
					}
					break;
				case 'updateDestinationFulfillmentCenter':
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					var infoItems = JSON.parse(objpage)
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
						return;
					}else if(infoItems.length > 1){
						layer.msg("只允许选择一条数据,请核实后在操作！");
						return;
					}else if(infoItems.some(item => item.state != '3')){
						layer.msg("选择数据只允许是FBA已导入状态下,请核实后在操作！");
						return;
					}else {
						layer.confirm('确定要修改仓库标识么?', {
							icon: 3,
							offset: '10%',
							title: "系统提示",
							shadeClose:true,
							btn: ['确认', '取消'],
							yes: function(index){
								//确认关闭当前diglog
								layer.closeAll('dialog');
								//填写修改仓库标识
								layer.open({
									type: 1,
									area: ['354px', '178px'],
									title: '修改仓库标识',
									offset: '20%',
									shadeClose:true,
									content: `
										  <div class="layui-form-item">
											 <label class="layui-form-label"><i style="color:red">*&nbsp;&nbsp;</i>FBA编号</label>
											 <div class="layui-input-block">
												<input type="text" name="shipmentId" value=${infoItems[0]?.shipmentId?infoItems[0]?.shipmentId: ''} required  lay-verify="required" placeholder="请输入FBA编号" autocomplete="off" class="layui-input shipmentId"
												maxlength="20" readonly="readonly">
											 </div>
										  </div>
										  <div class="layui-form-item">
											 <label class="layui-form-label"><i style="color:red">*&nbsp;&nbsp;</i>仓库标识</label>
											 <div class="layui-input-block">
												<input type="text" name="destinationFulfillmentCenterId" required  lay-verify="required" placeholder="请输入仓库标识" autocomplete="off" class="layui-input destinationFulfillmentCenterId"
												value=${infoItems[0]?.destinationFulfillmentCenterId?infoItems[0]?.destinationFulfillmentCenterId: ''}
												maxlength="20">
											 </div>
										  </div>
									 	  `,
									btn: ['确认', '取消'],
									yes: function (index, layero) {
										var destinationFulfillmentCenterId = $('.destinationFulfillmentCenterId').val().trim()
										var shipmentId = $('.shipmentId').val().trim()
										if (shipmentId.replace(/(^\s*)|(\s*$)/g, "") == "") {
											return layer.msg("请填写FBA编号!")
										}
										if (destinationFulfillmentCenterId.replace(/(^\s*)|(\s*$)/g, "") == "") {
											return layer.msg("请填写仓库标识!")
										}
										var infoItems=JSON.parse(objpage)
										showloadings(true);
										$.operate.post('/logstics/fbabox/updateDestinationFulfillmentCenter',{infoItems:JSON.stringify(infoItems),"destinationFulfillmentCenterId":destinationFulfillmentCenterId},function(result){
											if (result.code == 0) {
												setTimeout(function () {
													layer.closeAll();
													sessionStorage.setItem(moduleTable + 'checkdata', '')
													showloadings(false);
													table.reload('dhtable', {page: {curr: 1}, where: getWherestr()});
												}, 1000);
											} else {
												showloadings(false);
											}
										});
									}
								});
							},
							btn2: function(){
								//layer.closeAll();
								return true;
							}
						});
					}
					break;
				case 'personnelImport':
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					var infoItems = JSON.parse(objpage)
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
						return;
					}else {
						layer.confirm('确定要导入贴标装箱人么?', {
							icon: 3,
							offset: '10%',
							title: "系统提示",
							btn: ['确认', '取消'],
							shadeClose:true,
							yes: function(index){
								//确认关闭当前diglog
								layer.closeAll('dialog');
								//填写备注
								layer.open({
									type: 1,
									area: ['354px', '178px'],
									title: '贴标装箱人导入',
									offset: '20%',
									shadeClose:true,
									content: `
									<div class="layui-form-item">
										<label class="layui-form-label"><i style="color:red">*&nbsp;&nbsp;</i>贴标人</label>
										<div class="layui-input-block">
											<input type="text" name="labelingPerson" required  lay-verify="required" placeholder="请输入贴标人" autocomplete="off" class="layui-input labelingPerson"
											maxlength="15">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label"><i style="color:red">*&nbsp;&nbsp;</i>装箱人</label>
										<div class="layui-input-block">
											<input type="text" name="packingPerson" required  lay-verify="required" placeholder="请输入装箱人" autocomplete="off" class="layui-input packingPerson"
											maxlength="15">
										</div>
									</div>
									`,
									btn: ['确认', '取消'],
									yes: function (index, layero) {
										var labelingPerson = $('.labelingPerson').val().trim()
										var packingPerson = $('.packingPerson').val().trim()
										if (labelingPerson.replace(/(^\s*)|(\s*$)/g, "") == "") {
											return layer.msg("请填写贴标人!")
										}
										if (packingPerson.replace(/(^\s*)|(\s*$)/g, "") == "") {
											return layer.msg("请填写装箱人!")
										}
										var infoItems=JSON.parse(objpage)
										showloadings(true);
										$.operate.post('/logstics/fbabox/personnelImport',{infoItems:JSON.stringify(infoItems),"labelingPerson":labelingPerson,"packingPerson":packingPerson},function(result){
											if (result.code == 0) {
												setTimeout(function () {
													layer.closeAll();
													sessionStorage.setItem(moduleTable + 'checkdata', '')
													showloadings(false);
													table.reload('dhtable', {page: {curr: 1}, where: getWherestr()});
												}, 1000);
											} else {
												showloadings(false);
											}
										});
									}
								});
							},
							btn2: function(){
								//layer.closeAll();
								return true;
							}
						});
					}
					break;
				case 'placeOrder'://装箱
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else{
						$.modal.confirmCom('确定要装箱么？',function(result){
							var infoItems=JSON.parse(objpage);
							if (infoItems.some(item => item.state != '0')) {
								layer.msg("选择单据只允许是未装箱状态,请核实后在操作!");
								return;
							}
							//是否需要判断透明标
							if (infoItems.some(item => item.isfmb != '0')) {
								if (infoItems.some(item => item.statePrint != '3')) {
									layer.msg("选择单据中配货清单和商品标和透明标未打印,请核实后在操作!");
									return;
								}
							}else {
								if (infoItems.some(item => item.statePrint != '2')) {
									layer.msg("选择单据中配货清单和商品标未打印,请核实后在操作!");
									return;
								}
							}
							if (infoItems.some(item => item.state == '1')) {
								layer.msg("选择单据有已审核状态,请核实后在操作!");
								return;
							}
                            let voluntarily = infoItems.some(item => item.creationMethod == '自动');
                            let handMovement = infoItems.some(item => item.creationMethod == '手动');
                            if (voluntarily && handMovement){
                                layer.msg("选择单据货件创建方式只允许单一选择,请核实后在操作!");
                                return;
                            }
                            if (handMovement){
                                urlSh = ali1688EcpApiUrl+'/api/fbaInbound/placeOrder';
                            } else {
                                if(infoItems.length > 1) {
                                    layer.msg("选择单据货件创建方式只允许选择一条数据,请核实后在操作!！");
                                    return;
                                }
                                urlSh = ali1688EcpApiUrl+'/api/fbaInbound/placeOrderZd';
                            }
							showloadings(true);
							$.operate.post(urlSh,{infoItems:JSON.stringify(infoItems),userId:userId},function(result){
								if (result.code == 0){
									setTimeout(function(){
										sessionStorage.setItem(moduleTable+'checkdata','')
										showloadings(false);
										table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
									}, 1000);
								} else {
									showloadings(false);
								}
							});
						});
					}
					break;
				case 'cancelTc'://更新追踪编号
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else{
						$.modal.confirmCom('确定要上传头程追踪编号么？',function(result){
							var infoItems=JSON.parse(objpage);
							if (infoItems.some(item => item.state != '1')) {
								layer.msg("选择单据只允许是已完成状态,请核实后在操作!");
								return;
							}
							if (infoItems.some(item => item.stateTrack != '2') && infoItems.some(item => item.stateTrack != '4')) {
								layer.msg("选择单据中当前状态不允许上传头程追踪编号,请核实后在操作!");
								return;
							}
							let voluntarily = infoItems.some(item => item.creationMethod == '自动');
							let handMovement = infoItems.some(item => item.creationMethod == '手动');
							if (voluntarily && handMovement){
								layer.msg("选择单据货件创建方式只允许单一选择,请核实后在操作!");
								return;
							}
							if (handMovement){
								layer.msg("选择单据中货件创建方式:手动不允许操作,请核实后在操作!");
								return;
							} else {
								if(infoItems.length > 1) {
									layer.msg("选择单据货件创建方式只允许选择一条数据,请核实后在操作!！");
									return;
								}
								urlSh = ali1688EcpApiUrl+'/api/fbaInbound/uploadtraceNumber';
							}
							showloadings(true);
							$.operate.post(urlSh,{infoItems:JSON.stringify(infoItems),userId:userId},function(result){
								if (result.code == 0){
									setTimeout(function(){
										sessionStorage.setItem(moduleTable+'checkdata','')
										showloadings(false);
										table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
									}, 1000);
								} else {
									showloadings(false);
								}
							});
						});
					}
					break;
				case 'print'://打印箱标
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else{
						$.modal.confirmCom('确定要打印箱标么？',function(result){
							var infoItems=JSON.parse(objpage);
							urlSh = ali1688EcpApiUrl+'/api/fbaInbound/getLabels';
							showloadings(true);
							
							$.operate.post(urlSh,{infoItems:JSON.stringify(infoItems),userId:userId},function(result){

								if (result.code == 0){
									var urlBegin = window.location.href.split("//")[0];
									for (let i = 0; i < result.data.length; i++) {
										
										$.operate.post('/logstics/fbabox/generateOuterXiangBiaoPDF',{bid: infoItems[i].bid},function(result2){
											if (result2.code == 0){
												var urlPdfOuter = urlBegin + "//" + window.location.host + result2.data;
												
												var urlPdf = ali1688EcpApiUrl+result.data[i].data; // 拼接PDF的完整路径
												var json = {};
												json.action = "previewfile";	//打印指令动作。json.action = "preview"，则生成预览。
												json.format = "pdf_url";        //指定格式为pdf_url。
												json.docwidth = 20; // 单位：cm
												json.doclength = 30; // 单位：cm
												
												json.paperwidth = 10;
												json.paperlength = 10;
												json.content = [urlPdfOuter,urlPdf,urlPdf,urlPdf,urlPdf];   //pdf文件的url路径
												//json.copies = 4;
												json.cert = window.location.href.split("//")[0] + "//" + window.location.host + "/js/printWorld/pdf_mini-ease.com.ctf";
												var pw = GetPrintWorld();    //获取打天下对象
												pw.Act(json);
												// window.open(result.data[i].data)
												// window.open(ali1688EcpApiUrl+"/api/fbaInbound/FBA15GMVQPZ4?"+"params=" + infoItems[i].shipmentId)
												// window.open(ali1688EcpApiUrl+result.data[i].data)
											}
										});
									}
									setTimeout(function(){
										sessionStorage.setItem(moduleTable+'checkdata','')
										showloadings(false);
										table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
									}, 1000);
								} else {
									showloadings(false);
								}
							});
						});
					}
					break;
				case 'unbox'://取消装箱
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else{
						$.modal.confirmCom('确定要取消装箱么？',function(result){
							var infoItems=JSON.parse(objpage);
							if (infoItems.some(item => item.state != '2')) {
								layer.msg("选择单据只允许是已装箱状态,请核实后在操作!");
								return;
							}
							if (infoItems.some(item => item.isBinning == '是')) {
								layer.msg("选择单据只允许是未分箱状态,请核实后在操作!");
								return;
							}
							if (infoItems.some(item => item.isDeliver == 1)) {
								layer.msg("选择单据不允许海外仓头程取消,请核实后在操作!");
								return;
							}
							urlSh = ali1688EcpApiUrl+'/api/fbaInbound/unbox';
							showloadings(true);
							$.operate.post(urlSh,{infoItems:JSON.stringify(infoItems)},function(result){
								if (result.code == 0){
									setTimeout(function(){
										sessionStorage.setItem(moduleTable+'checkdata','')
										showloadings(false);
										table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
									}, 1000);
								} else {
									showloadings(false);
								}
							});
						});
					}
					break;
				case 'printList'://导出发票清单
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else{
						$.modal.confirmCom('确定要导出发票清单么？',function(result){
							var infoItems=JSON.parse(objpage);
							urlSh = shbtnUrl+'/printList';
							$.ajax({
								url: urlSh,
								type: 'post',
								data: {infoItems:JSON.stringify(infoItems)},
								dataType: 'json',
								beforeSend: function () {
									showloadings(true);
								},
								success: function (result) {
									if (result.code == 0) {
										window.location.href = ctx + "common/download?fileName=" + encodeURIComponent(result.msg) + "&delete=" + true;
										parent.$('.page-loading').hide();//页面进行了跳转刷新，需要手动关闭页面的加载动画
										layer.closeAll();
										// $.modal.alert("发票清单导出成功!")
									} else if (result.code == web_status.WARNING) {
										$.modal.alertWarning(result.msg)
									} else {
										$.modal.alertError(result.msg);
									}
									showloadings(false);
								}
							});
						});
					}
					break;
				case 'isShipments'://标记发货
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else{
						$.modal.confirmCom('确定要标记发货么？',function(result){
							var infoItems=JSON.parse(objpage);
							if (infoItems.some(item => item.stateTrack == '4')) {
								layer.msg("选择单据中存在物流已发货,无需再次操作!");
								return;
							}
							if (infoItems.some(item => item.stateTrack != '1')) {
								// layer.msg("选择单据中未审核,请核实后在操作!");
								layer.msg("选择单据中未审核,请核实后在操作!");
								return;
							}
							if (infoItems.some(item => item.statePrint == '4')) {
								layer.msg("选择单据中存在箱标未打印,请核实后在操作!");
								return;
							}
							showloadings(true);
							$.operate.post('/logstics/fbabox/isShipments',{infoItems:JSON.stringify(infoItems)},function(result){
								if (result.code == 0){
									setTimeout(function(){
										sessionStorage.setItem(moduleTable+'checkdata','')
										showloadings(false);
										table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
									}, 1000);
								} else {
									showloadings(false);
								}
							});
						});
					}
					break;
				case 'zxwcShbtn'://完成单审核
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("请先选择数据！");
					}else{
						$.modal.confirmCom('确定要审核么？',function(result){
							var infoItems=JSON.parse(objpage);
							if (infoItems.some(item => item.isDeliver == 1)) {
								layer.msg("选择单据不允许海外仓头程审核,请核实后在操作!");
								return;
							}
							if (infoItems.some(item => item.statePrint != '5')) {
								layer.msg("选择单据中不是箱标已打印状态,不允许审核!");
								return;
							}
							if (infoItems.some(item => item.stateTrack != '0')) {
								layer.msg("选择单据中物流状态不是无,请核实后在操作!");
								return;
							}
							showloadings(true);
							$.operate.post('/logstics/fbabox/zxwcShbtn',{infoItems:JSON.stringify(infoItems)},function(result){
								if (result.code == 0){
									setTimeout(function(){
										sessionStorage.setItem(moduleTable+'checkdata','')
										showloadings(false);
										table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
									}, 1000);
								} else {
									showloadings(false);
								}
							});
						});
					}
					break;
				case 'printPeihuoGoodsTag'://打印配货商品标签
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]'){
						layer.msg("至少选择一条数据！");
						break;
					}
					var infoItems=JSON.parse(objpage);
					if(infoItems.length > 1) {
						layer.msg("只能选择一条数据！");
						break;
					}
					var codes = '';
					for(var i=0; i<infoItems.length; i++) {
						codes = codes + infoItems[i].code + ',';
					}
					
					var urlBegin = window.location.href.split("//")[0];
					var json = {};
					json.action = "print";	//打印指令动作。json.action = "preview"，则生成预览。
					json.template = urlBegin + "//" + window.location.host + "/js/printWorld/muban/peihuoGoodsTag.fmx";	//模板URL，位于WEB服务器的一个模板文件。

					$.post('/logstics/fbabox/getPeihuoGoodsTagPrintInfo',{codes:codes},function(result){
						if (result.code == 0){
							var datas = result.data.rows;
							json.data = datas;
							json.action = "preview";
							var pw = GetPrintWorld();	//获取打天下对象
							pw.Act(json);
						}
					});
					break;
				case 'download':
					//下载C88附件
					var objpage=sessionStorage.getItem(moduleTable+'checkdata')
					if(!objpage || objpage == '[]') {
						layer.msg("请先选择数据！");
					}else {
						var infoItems=JSON.parse(objpage);
						if(infoItems.length > 1) {
							layer.msg("只允许选择一条数据,请核实后在操作！");
							return;
						}else {
							getUploadCommon("vDFilesDefault", "Head", infoItems[0].lOGUid);
						}
					}
				break;
			};
		});

	});

	let isfx = 0;
	function  importBtn(data){
		importFields = data ===4 ? importFields : importFieldFH;
		isfx = data;
		if (importFields) {
			thStr = '<tr><th><div style="width:30px;">序号</div></th>';
			$.each(importFields, function (i, val) {
				fieldWidth[val] = fieldWidth[val] ? fieldWidth[val] : 100;	//默认宽度100px
				thStr += '<th><div style="width:' + fieldWidth[val] + 'px;">' + i + '</div></th>';
			})
			thStr += '</tr>';
			layer.open({
				type: 1,
				area: ['400px', '230px'],
				fix: false,
				offset: '10%',
				maxmin: true,
				shade: 0.3,
				title: '导入',
				content: `
						<form enctype="multipart/form-data" class="mt20 mb10">
							<div class="col-xs-offset-1">
							<input type="file" id="file" name="file"/>
							<div class="mt10 pt5">
							<a onclick="$.tablelist.importTemplate('/logstics/fbabox/export?num=${data}')" class="btn btn-default btn-xs"><i class="dhicon dh-file-excel-o"></i> 下载模板</a>
							</div>
							<font color="red" class="pull-left mt10">提示：仅允许导入“xls”或“xlsx”格式文件！</font>
							</div>
						</form>
												`,
				btn: ['<i class="dhicon dh-check"></i> 导入', '<i class="dhicon dh-remove"></i> 取消'],
				shadeClose: true,
				zIndex: 1000,
				btn1: function (index, layero) {
					var file = layero.find('#file');
					if (!file[0]['value']) {
						layer.msg("请选择文件！");
						return false;
					}
					var imRes = importListExcel(file[0], importFields, data === 1?'fbaBox':'fbaBoxFH');
				}
			});
		} else {
			$.modal.alertWarning("后台未返回导入模板对象！");
		}
	}

	/*批量请求导入数据
     *tobj：导入数据对象
     *startNum：从第几条开始导入
     *oneImportNum：每次导入条数
     *allImportNum：总数据量
     *times：导入次数
     */
	function eachImport(tobj,startNum, oneImportNum, allImportNum, times, timeNum){
		var importObj = [];
		for(var i = startNum; i < allImportNum; i++){
			importObj.push(tobj[i]);
		}
		if (importObj.length ==0){
			layer.msg("导入数据为空,请核实后在操作!");
			showloadings(false);
			return;
		}
		$.ajaxSettings.async = false;
		//0导入追踪编号\1标记发货
		$.operate.post(isfx == 4?'/logstics/fbabox/importdatapost':'/logstics/fbabox/batchDelivery', {'infoItems':JSON.stringify(importObj)}, function(result) {
			showloadings(false);
			if(result.code == 0){
				layer.msg(result.msg)
				setTimeout(function(){
					sessionStorage.setItem(moduleTable+'checkdata','')
					layer.closeAll();
					table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
				}, 1000);
			}
			if (isfx == 5){

				if(result.code ==400){
					//批量标记发货
					window.location.href = ctx + "common/download?fileName=" + encodeURIComponent(result.data) + "&delete=" + true;
					parent.$('.page-loading').hide();//页面进行了跳转刷新，需要手动关闭页面的加载动画
				}
			}
		},"json");
	}

	//通过guid彻底删除
	function remove(){
		var objpage=sessionStorage.getItem(moduleTable+'checkdata')
		if(!objpage || objpage == '[]'){
			layer.msg("请先选择数据！");
		}else{
			$.modal.confirmCom('确定要删除么？',function(result){
				var infoItems=JSON.parse(objpage)
				showloadings(true);
				$.operate.post('/business/fbaplanorder/delete',{infoItems:JSON.stringify(infoItems)},function(result){
					if (result.code == 0){
						setTimeout(function(){
							showloadings(false);
							table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
						}, 1000);
					} else{
						showloadings(false);
					}
				});
			});
		}
	}

	// 筛选1个数组相同的数据
	function newData(arr) {
		const map = {};
		arr.forEach(item => {
			const obj = {};
		Object.keys(item).sort().map(key => obj[key] = item[key]);
		map[JSON.stringify(obj)] = item;
	});
		return Object.keys(map).map(key => JSON.parse(key));
	}

	// 筛选2个数组相同的数据
	function delData(data, deldata) {
		data.forEach(item => {
			deldata = deldata.filter(items => items.guid != item.guid);
	});
		return deldata;
	}

	//同步访问后端接口
	function  post(urlSh,infoItems,userId) {
		showloadings(true);
		$.post(urlSh,{'state':1,infoItems:JSON.stringify(infoItems),'num':0,userId:userId,'type':0},function(result){
			if (result.code == 0){
				layer.msg(result.msg);
				setTimeout(function(){
					sessionStorage.setItem(moduleTable+'checkdata','')
					layer.closeAll();
					showloadings(false);
					table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
				}, 1000);
			} else if (result.code == 200){
				showloadings(false);
				layer.closeAll();
				var str = `<div class="tablebody"><table style="text-align:center" class="layui-table zjtable">
					<thead><tr>
					<th style="text-align:center">序号</th><th style="text-align:center">FBA编号</th><th style="text-align:center">仓库标识</th><th style="text-align:center">Amazon预估费用</th><th style="text-align:center">币种</th>
					</thead><tbody id="tbody">`;
				$.each(result.data, function (i, v) {
					str += `<tr>`;
					str += `<td>${i+1}</td>`;
					str += `<td>${v.shipmentId}</td>`;
					str += `<td>${v.destinationFulfillmentCenterId}</td>`;
					str += `<td>${v.currencyAmount}</td>`;
					str += `<td>${v.currency}</td>`;
					str += `</tr>`;
				});
				str += `</tbody></table></div>`;
				layer.open({
					type: 1,
					area: [($(window).width() - 200)+'px', ($(window).height() - 100)+'px'],
					fix: false,//不固定
					offset: '10%',//距离顶部
					maxmin: true,//最大最小化
					shade: 0.3,//遮罩
					title: '头程生成预测',
					content:str,
					btn: ['确定', '取消'],
					shadeClose: true,// 弹层外区域关闭
					yes: function(index, layero){
						// if (result.data.length > 1){
						// 	layer.msg(result.msg);
						// } else {
							showloadings(true);
							$.post(urlSh,{'state':1,infoItems:JSON.stringify(infoItems),'num':0,userId:userId,'type':1},function(result1){
								layer.msg(result1.msg);
								setTimeout(function(){
									sessionStorage.setItem(moduleTable+'checkdata','')
									showloadings(false);
									layer.closeAll();
									table.reload('dhtable', {page: {curr: 1},where:getWherestr()});
								}, 1000);
							})
						// }
					}
				});
			} else {
				showloadings(false);
				layer.msg(result.msg);
			}
		});
	}

	//手动写导入功能
	function  importBtnNew(){
		var objpage=sessionStorage.getItem(moduleTable+'checkdata')
		if(!objpage || objpage == '[]'){
			layer.msg("至少选择一条数据！");
			return;
		}
		var infoItems=JSON.parse(objpage);
		if(infoItems.length > 1) {
			layer.msg("只能选择一条数据！");
			return;
		}
		var w=($(window).width()*0.9);
		var h=($(window).height() - 50);
		layer.open({
			type: 2,
			area: [w+'px', h +'px'],
			fix: true,
			maxmin: false,
			shadeClose: true,
			shade:0.4,
			title: "装箱清单导入",
			content: '/logstics/fbabox/toImportBatch?codeBox='+infoItems[0].code+"&codeShipment="+infoItems[0].codeShipment+"&shipmentId="+infoItems[0].shipmentId
		});
	}

</script>
</body>
</html>